# -*- coding: utf-8 -*-
"""
@Time ： 2021/11/25 21:52
@Auth ： Mr. William 1052949192
@Company ：特斯汀学院 @testingedu.com.cn
@Function ：12306滑块验证码，关键字驱动
"""
import time

from selenium.webdriver import Keys
from selenium.webdriver.common.by import By

from keywords.webkeys import Web

web=Web()
web.openbrowser()
web.geturl('https://kyfw.12306.cn/otn/resources/login.html')
web.input('//*[@id="J-userName"]','i_wanting@yeah.net')
web.input('//*[@id="J-password"]','xiaobao168')
web.click('//*[@id="J-login"]')
web.sleep(1)
web.myslide('//span[@class="nc_iconfont btn_slide"]','//span[@class="nc-lang-cnt"]')
web.sleep(2)
# web.quit()
web.geturl('https://kyfw.12306.cn/otn/leftTicket/init')
# try:
#     web.click('//*[@id="qd_closeDefaultWarningWindowDialog_id"]')
# except:
#     pass

web.click('//*[@id="fromStationText"]')
web.input('//*[@id="fromStationText"]','长沙南 ')
web.driver.find_element(By.XPATH,'//*[@id="fromStationText"]').send_keys(Keys.BACKSPACE)
web.click('//*[@id="citem_0"]')
time.sleep(50)

